package com.neuedu.jdboot.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.jdboot.bean.Admin;
import com.neuedu.jdboot.common.JdbootException;
import com.neuedu.jdboot.mapper.AdminMapper;
import com.neuedu.jdboot.service.AdminService;

/**
 * 
 * @author chens
 *
 */
@Service
@Transactional(rollbackFor = JdbootException.class)
public class AdminServiceImpl extends DefaultServiceImpl<Admin> implements AdminService {

	@Autowired
	private AdminMapper adminMapper;

	@Override
	public boolean updateStatus(Integer adminId, Integer status) {
		boolean ret = false;
		try {
			ret = adminMapper.updateStatus(adminId, status);
		} catch (Exception e) {
			throw new JdbootException("修改异常", e);
		}
		return ret;
	}

	@Override
	public Admin login(String account) {
		Admin admin = null;
		try {
			admin = adminMapper.login(account);
		} catch (Exception e) {
			throw new JdbootException("登陆异常", e);
		}
		return admin;
	}
}
